<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>视频下面的按钮</title>
    <!-- <link rel="stylesheet" type="text/css" href="./../../css/video.css" /> -->
    <style>
    body,html{
    height: 0px;
    }
    .center {
          background-color: black;
          text-align: center;
          border-radius: 20px;
          color: #fff;
          display: inline-block;
          padding: 4px 7px;
          font-size: 12px;
    }
    .img_wjt {
        width: 10px;
        display: inline-block;
    }

    .img_pro {
        position: absolute;
        bottom: 27px;
        padding: 0px 15px;
        height: 10px;
        width: 100%;
    }
    .daojishi{
      font-size: 14px;
      margin-right: 8px;
      position: relative;
    }
    .daojishi::after{
      position: absolute;
      content: "";
      top: 0px;
      height: 15px;
      width: 1px;
      left: 21px;
      background: #fff;
    }
    *{
      margin: 0px;
      padding: 0px;
    }

    </style>
</head>

<body>
    <div id="vm" v-cloak>
      <div class="center" v-show='flag'>
          <span v-html="keguankan"></span>
          <span style="color:#FFBA14;font-size:14px;" v-html="daojishi"></span>
          <!-- <span v-if="videotype==1">分钟，购买后继续观看</span> -->
          <!-- <span v-if="videotype==2"  @click="buyvip()" v-html="vipup"></span>
          <span v-if="videotype==3"  @click="buyshipin()" v-html="vipup2"></span> -->
          <span v-if="videotype==2"  v-html="vipup"></span>
          <span v-if="videotype==3"  v-html="vipup2"></span>
      </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/rest.js"></script>
<script type="text/javascript" src="../../script/vue.2.5.js"></script>
<script type="text/javascript" src="../../script/faskclick.js"></script>
<script type="text/javascript">
    var uid = $api.getStorage('uid')
    var vm = new Vue({
        el: '#vm',
        data: {
          daojishi:60,
          palytime:0,
          isvip:false,
          videotype:'',
          usertype:0,
          keguankan:'可以观看',
          vipup:'秒，升级会员继续观看',
          vipup2:'秒，购买完整视频继续观看',
          flag:false
        },
        created: function() {
            var _this = this;
            apiready = function() {
                api.parseTapmode();
                if ('addEventListener' in document) {
                    document.addEventListener('DOMContentLoaded', function() {
                        FastClick.attach(document.body);
                    }, false);
                }
                // api.addEventListener({
                //     name: 'canplaytime'
                // }, function(ret, err){
                //       _this.palytime = parseInt(ret.value.canplaytime);
                //       console.log(_this.palytime)
                // });
                api.addEventListener({
                    name: 'keguankanguanbi'
                }, function(ret, err){
                    api.closeFrame();

                });


                _this.daojishi = parseFloat(api.pageParam.freetime);
                _this.init();
                // _this.videotype=api.pageParam.videotype;
                _this.usertype=api.pageParam.usertype;
                //如果是会员
                if (_this.usertype==1) {
                      if(api.pageParam.videotype==3){
                             _this.videotype = 3
                      }
                //如果不是会员或者未登录
                }else {
                  if(api.pageParam.videotype==3){
                         _this.videotype = 3
                  }else if(api.pageParam.videotype==2) {
                       _this.videotype = 2
                  }
                }
                // setTimeout(function() {
                  _this.flag = true;
                // },300)

            }
        },
        methods: {
            init: function() {
              var _this = this;
              // var time = setInterval(function() {
              //         _this.daojishi--
              //         if (_this.daojishi<=0) {
              //                 clearInterval(time)
              //         }
              // },1000)

            },
            buyvip(){
              api.openWin({
                  name: 'unbuy_vip_win',
                  url: '../VIP/unbuy_vip_win.html',
              });
            },
            buyshipin(){
              var _this=this;
              if(_this.usertype==0){
                api.openFrame({
                    name: 'undakaunvip_buyvideo',
                    url: '../VIP/undakaunvip_buyvideo.html',
                    rect: {
                        x: 0,
                        y: 0,
                        w: 'auto',
                        h: 'auto'
                    },
                    pageParam: {
                        videocash: api.pageParam.videodetail.cash,
                        videovipcash: api.pageParam.videodetail.video_vip_cash,
                        videoid: api.pageParam.videodetail.id,
                        riqi: api.pageParam.videodetail.endtime,
                    },
                    bounces: false,
                    bgColor: 'rgba(0,0,0,0)',
                    vScrollBarEnabled: true,
                    hScrollBarEnabled: true
                });
              }else{
                api.openFrame({
                    name: 'undakavip_buyvideo',
                    url: '../VIP/undakavip_buyvideo.html',
                    rect: {
                        x: 0,
                        y: 0,
                        w: 'auto',
                        h: 'auto'
                    },
                    pageParam: {
                      videocash: api.pageParam.videodetail.cash,
                      videovipcash: api.pageParam.videodetail.video_vip_cash,
                      videoid: api.pageParam.videodetail.id,
                      riqi: api.pageParam.videodetail.endtime,
                    },
                    bounces: false,
                    bgColor: 'rgba(0,0,0,0)',
                    vScrollBarEnabled: true,
                    hScrollBarEnabled: true
                });
              }

            },
            settime:function(ret) {
              var time = parseFloat(ret);   //先将毫秒转化成秒
                if (null != time && "" != time) {
                    if (time > 60 && time < 60 * 60) {
                        time = parseInt(time / 60.0) + ":" + parseInt((parseFloat(time / 60.0) -
                            parseInt(time / 60.0)) * 60) ;
                    }
                    else if (time >= 60 * 60 && time < 60 * 60 * 24) {
                        time = parseInt(time / 3600.0) + ":" + parseInt((parseFloat(time / 3600.0) -
                            parseInt(time / 3600.0)) * 60) + ":" +
                            parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) -
                            parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) ;
                    }
                    else {
                        time = parseInt(time) ;
                    }
                }
                return time;
            }
            // guanbiguanggao:function() {
                // if (this.isvip) {
                //   api.sendEvent({
                //       name: 'guanbidaojishi'
                //   });
                //   api.closeFrame();
                // }else {
                //   api.toast({
                //       msg: '会员可以关闭',
                //       duration: 2000,
                //       location: 'bottom'
                //   });
                //
                // }
            // }
        }
    })
</script>

</html>
